#include "tank_show_plugin.h"
#include "TankShowdown.h"

ModuleLinkerSPtr				global_module_linker_ = nullptr;
BattleArenaSPtr					global_battle_arena_ = nullptr;
BattleBotsSPtr					global_battle_bots_ = nullptr;
LoggerFactorySPtr				global_log_factory_ = nullptr;

TankShowPlugin::TankShowPlugin(QObject* parent) : QObject(parent) {

}

TankShowPlugin::~TankShowPlugin() {

}

void TankShowPlugin::InitPlugin(ModuleLinkerSPtr _context_ptr)
{
	if (!global_module_linker_)
		global_module_linker_ = _context_ptr;

	TankShowDownSPtr tank_show_ptr = std::make_shared<TankShowdown>();
	global_module_linker_->SetServicePtrById(TANKSHOWSERVICEID, tank_show_ptr);
}

void TankShowPlugin::StartPlugin()
{
	if (!global_module_linker_)
		return;

	global_battle_arena_ = Service(IBattleArena, BATTLEARENASERVICEID, global_module_linker_);
	global_battle_bots_ = Service(IBattleBots, BATTLEBOTSSERVICEID, global_module_linker_);
	global_log_factory_ = Service(ILoggerFactory, LOGGERFACTORYSERVICEID, global_module_linker_);

	return;
}